package com.example.graduation.mapper;

import com.example.graduation.entity.Goods;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.graduation.vo.Sold;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author xyc
 * @since 2022-02-11
 */
@Mapper
public interface GoodsMapper extends BaseMapper<Goods> {
    /**
     * 根据orderId查询用户的订单具体内容
     *
     * @param orderId
     * @return {@link List< Goods>}
     * @author xieyucan
     * CreateDate 2022/3/2 16:52
     */
    List<Goods> selectGoodsByOrderId(Integer orderId);


    /**
     * 查询商店中有什么商品(查询改商店的所有商品)
     *
     * @param shopId
     * @param status
     * @return {@link List< Goods>}
     * @author xieyucan
     * CreateDate 2022/3/2 17:53
     */
    List<Goods> selectGoodsByShopId(Integer shopId, Integer status);


    /**
     * 根据商店id，商品状态，商品类型进行查询
     *
     * @param shopId
     * @param status
     * @param type
     * @return {@link List< Goods>}
     * @author xieyucan
     * CreateDate 2022/3/2 17:57
     */
    List<Goods> selectGoodsByType(Integer shopId, Integer status, Integer type);


    /**
     * 根据商店id和商品id查询出商品
     *
     * @param shopId
     * @param goodsId
     * @return {@link Goods}
     * @author xieyucan
     * CreateDate 2022/3/3 17:39
     */
    Goods selectGoodsById(Integer shopId, Integer goodsId);


    /**
     * 减商品库存量,count为库存最终的数量
     *
     * @param shopId
     * @param goodsId
     * @param count
     * @author xieyucan
     * CreateDate 2022/3/3 17:46
     */
    void updateCount(Integer shopId, Integer goodsId, Integer count);


    List<Sold> selectnum(Integer shopId);
}
